home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGMISC / FPCDOCS.LZH / EDITOR.DOC < prev    next >
Text File  |  1988-06-01  |  18KB  |  421 lines

  1. IV.  SED, THE EDITOR 
  2.  
  3.  
  4.  
  5. SED is a sequential file text editor implemented in F-PC by Tom
  6. Zimmer.  The editor is WordStar compatible from a cursor control 
  7. key stand point, with the keypad functions fully supported, along 
  8. with some function keys.  Full search, replace, and global replace 
  9. are provided, along with copy and paste of text segments within a 
  10. file as well as between files.  
  11.  
  12. SED was developed to provide an easy way to create and modify 
  13. source and documentation files for building substantial 
  14. application packages in F-PC.  You can enter the editor from F-PC
  15. and return to F-PC with very few key strokes so that program can be
  16. modified and tested quickly.  It has the convenience of the block 
  17. based F83 source loading mechanism, but not limited by the small 
  18. block size.  It also has the advantage of using standard 
  19. sequential text file common to most DOS word processors. 
  20.  
  21. SED allocates a 64K byte segment to store text file in RAM.  The 
  22. file is edited in RAM and saved back to disk when returning to 
  23. F-PC.  However, when a source file is compiled, the source code is
  24. extacted from the RAM storage one line at a time and compiled line 
  25. by line.  Thus complilation is very fast, averaged to about 10,000 
  26. lines per minute. 
  27.  
  28. Due to the fact that a 64K byte segment is allocated for text 
  29. during editing, SED handles files up to 64K bytes.  As files 
  30. generally should be used as a mechanism for modularizing source 
  31. code, it is a bad style and poor design to allow source files to 
  32. grow bigger than 10K bytes.  The purpose of SED is not for general 
  33. word processing but for program development, although one can do 
  34. substantial text manipulation with it, up to 64K byte limit. Yes. 
  35. Tom got rid of BLOCK.  But in a sense, BLOCK creeps back, 64 times 
  36. bigger.
  37.  
  38.  
  39.  
  40. 1.  SELECTING A FILE TO EDIT 
  41.  
  42.  
  43.  
  44. To enter the editor for an editing session, type the following:
  45.  
  46.                SED <filespec> <enter> 
  47.  
  48. A filename can be specified on the command line when starting SED, 
  49. and may include a directory specification.  If no file name is 
  50. given after SED, the editor will request a file name.  If the file 
  51. does not exist, a new file will be created for entering fresh 
  52. text.  If the file extension is not specified, SED uses the .SEQ 
  53. extension as default.  The editor then clear the screen and 
  54. displays the top 20 lines of the file in a window like display as 
  55. shown in Figure 1.  A line can be as long as 128 characters, of 
  56. which only 72 are visible in the window.
  57.  
  58. The top line of the display shows the current edit status, 
  59. starting with INSERT/OVERWRITE status, which is also shown by a 
  60. thicker cursor for insert mode.  The current Column and Line 
  61. number are then displayed, followed by the page number, total 
  62. lines in file and total characters in file.  The directory path 
  63. and the name of the current file under editing appear at the 
  64. bottom of the display 1. 
  65.  
  66. A new file selection mechanism has been added.  When you are being 
  67. asked to enter a new filename, if you press ENTER without entering 
  68. a filename, a window will pop up allowing you to select a file 
  69. from the directory.  If you are in a sub-directory when the window 
  70. appears, then a file named "." and a file named ".." will appear 
  71. at the top of the file list.  These files, along with any 
  72. directories below the current directory, will display a graphic 
  73. "infinity" symbol "∞" to the right of the filename.  If you press 
  74. <return> while positioned on the "." name you will select the ROOT 
  75. directory.  The ".." name will pop up one level of directory, and 
  76. any other name with the "infinity" symbol next to it will step you 
  77. down one level to that directory.  You can move between files in 
  78. the list, with the keypad arrow keys, and select a file by 
  79. pressing ENTER.  Escape can be used to abort file selection.  
  80. While in the pop up file selection mode, you can also set the 
  81. current drive by pressing a letter key between A and G.  This 
  82. drive must exist and have a disk in it, or a system error will 
  83. result.  The path and the current drive is displayed in the lower 
  84. right.  The path can be changed by pressing the "\" key, then 
  85. typing the new path followed by the return key. 
  86.  
  87. Pressing ESC key terminates the editing session and returns to 
  88. F-PC, after saving the modified text to disk.
  89.  
  90. Pressing F1 function key will replace the display with a help 
  91. screen as in Figure 2, showing variaous control keys for editing 
  92. functions in the WORDSTAR style.  
  93.  
  94. SED is designed to use most WORDSTAR control keys to move the 
  95. cursor and manipulate the text.  However, on an IBM-PC, it is most 
  96. convenient to use the cursor keys to position the cursor and then 
  97. insert new text or type over old text.  It is very easy to master 
  98. this editor without much effort.  The F1 help screen is always 
  99. ready for consultation.  For more sophisticated operations, refer 
  100. to Section 3 for details.
  101.  
  102. To re-enter SED and edit the currently openned text file, type
  103.  
  104.                ED
  105.  
  106. in F-PC without a file specification.  SED will display the text
  107. with the cursor positioned at the position when you left the last 
  108. editing session.  When the source file was compiled and an error 
  109. was detected, ED will place the cursor on the first character of 
  110. the offending word so that you can examine the situation and make 
  111. appropriate correction.  This way SED is tightly integrated into 
  112. F-PC as seamless as the block editor in F83.
  113.  
  114.  
  115.  
  116. 2.  WORDSTART KEY FUNCTIONS 
  117.  
  118.  
  119.  
  120. SED tries somewhat half heartedly to be WordStar compatible. The 
  121. cursor movement keys, Control A,S,D,F,E,X,C,R,W and Z have been 
  122. maintained, as have the delete keys Control G,T,Y, and Del. 
  123.  
  124.  
  125. KEY DEFINITION INDEX 
  126.  
  127.  
  128. Control keys 
  129.  
  130.         A       Previous word. 
  131.         B       .. 
  132.         C       Next page, Page Down. 
  133.         D       Right one character. 
  134.         E       Previous line, Up Line. 
  135.         F       Forward, Next word. 
  136.         G       Delete the character UNDER the cursor. 
  137.         H       Move left one character non-destructively. 
  138.         I       Same as TAB. 
  139.         J       .. 
  140.         K       .. 
  141.         L       .. 
  142.         M       Like the <return> key. 
  143.         N       Split line at cursor.  See also Alt-N (join line). 
  144.         O       .. 
  145.         P       .. 
  146.         Q       .. 
  147.         R       Previous page, Page Up. 
  148.         S       Left one character. 
  149.         T       Delete the word to the right. 
  150.         U       Update, save changes up to this moment. 
  151.         V       Insert/ Overwrite mode toggle. 
  152.         W       Scroll screen down. 
  153.         X       Next line, Down Line. 
  154.         Y       Cut/Delete the current Line. 
  155.         Z       Scroll the screen up. 
  156.  
  157. Keypad Functions 
  158.  
  159.         ESC         Exit SED and Save changes. 
  160.         Shift-ESC   Exit SED and Don't save changes. 
  161.         Home        Goto beginning of line. 
  162.         End         Goto end of line. 
  163.         PgUp        Go back towards beginning of document 12 
  164.                     lines. 
  165.         PgDn        Go towards end of document 12 lines. 
  166.         Ctrl-Home   Go to First line of document. 
  167.         Ctrl-End    Goto last line of document. 
  168.         Ins         Toggle between Insert and Overwrite mode. 
  169.         Del         Delete the character under the cursor. 
  170.  
  171. Alternate Keys 
  172.  
  173.         A       .. 
  174.         B       .. 
  175.         C       Insert the next key pressed into the document. 
  176.         D       .. 
  177.         E       .. 
  178.         F       .. 
  179.         G       .. 
  180.         H       .. 
  181.         I       .. 
  182.         J       .. 
  183.         K       Expand imbedded TAB characters to spaces. 
  184.         L       .. 
  185.         M       .. 
  186.         N       Join Lines, the inverse of Control N. 
  187.         O       .. 
  188.         P       .. 
  189.         Q       .. 
  190.         R       .. 
  191.         S       .. 
  192.         T       Set the TAB key to expand to the current column. 
  193.         U       Word Undelete, undeletes the last 10 words or so. 
  194.         V       Import a file, pops up a selection window. 
  195.         W       Write entire file to a new file. 
  196.         X       Export lines from mark to cursor. 
  197.         Y       Un-delete lines. 
  198.         Z       .. 
  199.  
  200. Function Keys 
  201.  
  202.         F1      .. 
  203.         F2      .. 
  204.         F3      Mark line, for copy lines, and export lines. 
  205.         F4      .. 
  206.         F5      Get a line from the mark. 
  207.         F6      Search, prompts for search text. 
  208.         F7      .. 
  209.         F8      Replace, prompts for replace text, must do F6 
  210.                 first. 
  211.         F9      .. 
  212.         F10     .. 
  213.  
  214.         Alt-F1  .. 
  215.         Alt-F2  .. 
  216.         Alt-F3  .. 
  217.         Alt-F4  .. 
  218.         Alt-F5  .. 
  219.         Alt-F6  Search for same text again, no prompt. 
  220.         Alt-F7  .. 
  221.         Alt-F8  Replace with same text again, no prompt and do 
  222.                 Alt-F6. 
  223.         Alt-F9  .. 
  224.         Alt-F10 .. 
  225.  
  226.         Shift-F6 
  227.                 Search for text backwards, CaSe sensitive. 
  228.         Shift-F8 
  229.                 Replace all occurrences, use after F6 and F8. 
  230.  
  231.         Shift-Alt-F6 
  232.                 Search for same text again, no prompt Case 
  233.                 sensitive. 
  234.         Shift-Alt-F8 
  235.                 Replace with same text again, no prompt Case 
  236.                 sensitive. 
  237.  
  238.  
  239.  
  240. 3.  GLOSSARY OF EDITING OPERATIONS 
  241.  
  242.  
  243.  
  244. Copying Lines                           F3 & F5 
  245.  
  246. Lines can be copied from one place in a file to another, with the 
  247. Mark-F3, and Copy Line-F5 commands.  Move to the first line of the 
  248. block of text you wish to copy, and Mark the start of the copy 
  249. with Mark-F3, now move to the place where you want to copy the 
  250. text to, and press Copy-F5 once for each line you want to copy. 
  251.  
  252. Delete and Un-Delete lines              Control-Y  &  Alt-Y 
  253.  
  254. Lines can be deleted with Ctrl-Y, and un-deleted with Alt-Y.  Any 
  255. lines which are deleted are saved in a line delete buffer which 
  256. currently has room for 50 lines.  This is also the number of line 
  257. deletes which can be un-deleted. 
  258.  
  259. Exporting a block of Text               Alt-X and Shift Alt-X 
  260.  
  261. SED can export lines of text to another file.  With Alt-X, first 
  262. go to the first line of text you want to export, and press F3 mark 
  263. to mark the start of the block export.  Then move to the last line 
  264. of text you want to export, and press Alt-X. This will cause all 
  265. of the lines between and including the start and end line to be 
  266. written out to the file TEMP.SEQ. To specify a different filename 
  267. to export to, press Shift-Alt-X, instead of Alt-X, and you will be 
  268. prompted for a name to write to.  See also "Importing a File". 
  269.  
  270. Exporting to another file               Alt-W 
  271.  
  272. The current edit file can be written out to another file. By 
  273. pressing Alt-W, you will be asked for the name of the file to 
  274. write out to.  The entire file contents in memory will be written 
  275. out to the new filename.  If you want to export a small amount of 
  276. text to another file, you can use the Alt-X Export function. 
  277.  
  278. HELP, on line                           F1 
  279.  
  280. Press F1 for on-line help on the various commands available. 
  281.  
  282. Importing a File                        Alt-V 
  283.  
  284. Text which has been exported with the Alt-X (export) command to 
  285. the TEMP.SEQ file can be imported with Alt-V, the import command.  
  286. If you want to import a file other than TEMP.SEQ, you can press 
  287. Shift-Alt-V, and a window will pop-up for you to select a file 
  288. from.  If you press Esc during the import, or while in the file 
  289. selection window, the import operation will be aborted.  See also 
  290. "Exporting a block of Text". 
  291.  
  292. Inserting Special characters in SED     Alt-C char 
  293.  
  294. The Alt-C function allows any single character which can be 
  295. generated by the keyboard to be inserted into SED.  Simply press 
  296. Alt-C followed by the key you want to insert.  Function keys are 
  297. mapped to characters above 127, so they will show up as graphics 
  298. characters. 
  299.  
  300. Left Margin                             Ctrl-L 
  301.  
  302. The left margin on the screen defaults to column zero, but when 
  303. printed, defaults to 2 spaces, so it is not normally necessary to 
  304. insert a left margin.  However, when TAB is pressed, the left 
  305. margin on screen is expanded by 8 characters.  Any subsequent 
  306. lines typed in will maintain this margin.  The left margin can be 
  307. set at any column position. Move the cursor to the column where 
  308. you want the left margin set and press Ctrl-L. 
  309.  
  310. MACROS and F-PC                           Alt-M, Alt-1..5
  311.  
  312. SED does not have macros built into it, but a file is provided 
  313. called MACROS.SEQ, which implements macros in Forth that can be 
  314. used in SED.  These macros work exactly the same as they work in 
  315. ZED.  That is, you use Alt-M to start defining a macro, followed 
  316. by one of the Alt-1 to Alt-5 keys for the macro you are defining.  
  317. Next you enter any keys you want included in the macro, and 
  318. finally press Alt-M again to complete the macro definition.  To 
  319. perform a macro, simply press one of the Alt-1 through Alt-5 keys 
  320. by it self, and the keys saved will be performed. 
  321.  
  322. Marker, Page Break  (a down pointing arrow head) 
  323.  
  324. The down pointing arrow head symbol is used by SED to mark the 
  325. first line of a NEW page, so you will notice this symbol appears 
  326. at the left edge of the screen at the top of the document. 
  327.  
  328. Marker, End of File (an up  pointing arrow head) 
  329.  
  330. The up pointing arrow head symbol is used by SED to mark the last 
  331. line of text in the file. 
  332.  
  333. Printing Documents                      Alt-P 
  334.  
  335. Printing can be initiated Alt-P.  It will take you to a screen 
  336. where you can set the printing parameters, like first and last 
  337. page to print, copies to print, etc.  These values default to the 
  338. most common situation, which is to print all of a document once.  
  339. To start printing, press "P", or press ESC to abort. 
  340.  
  341. Reading Foreign documents               Alt-K  Tab expansion 
  342.  
  343. If you want to read a text file from an editor which imbeds Tabs, 
  344. you will see this character " " in many places in the file when 
  345. you first start editing it.  If you do see these Tab characters, 
  346. press Alt-K, and these characters will be expanded to spaces 
  347. properly.  This process will increase the size of the file 
  348. somewhat, so if you are doing this to a very large file, you may 
  349. run out of the 64000 character memory space available. WordStar 
  350. document files will need to passed through a conversion utility 
  351. before being edited by SED. 
  352.  
  353. You can import a Forth BLOCK file by specifying the file and 
  354. extension on the file prompt line.  SED will not find any line 
  355. feeds in the file, so it will automatically split the file at 64 
  356. characters per line  After this is done, trailing blanks will be 
  357. stripped from each line, and trailing blank lines will be removed 
  358. from the file.  The resulting file will be much smaller, typically 
  359. 50 percent or less.  The original file is not modified, and the 
  360. new file is created with the extension ".TMP". 
  361.  
  362. Replacing Text                          F8-Replace & Alt-F8 
  363.  
  364. After a Search has been done, you can replace the text found.  
  365. Press F8.  You will be asked for a replacement string, which will 
  366. be used to replace the found text, when return is pressed.  To 
  367. search for the next occurrence of the same text, press Alt-F6, and 
  368. to replace the next found occurrence with the same replacement 
  369. text, press Alt-F8. 
  370.  
  371. Replacing All Occurrences of Text       Shift-F8 
  372.  
  373. Having already performed a Search (F6) and Replace (F8) once, you 
  374. can replace all occurrences of search text with replacement text 
  375. by pressing Shift-F8. 
  376.  
  377. Searching for Text                      F6-Search & Alt-F6 
  378.  
  379. You can look for any sequence of characters in SED with the 
  380. Search-F6 key.  When F6 is pressed, you are asked to enter a text 
  381. string to look for.  SED will look for that string of characters 
  382. when you press <return>.  When SED searches for text, it ignores 
  383. the case of the letters.  If you want SED to look at the CaSe of 
  384. the text it searches, hold down SHIFT while pressing <return>.  
  385. This search is much faster.  To search for another occurrence of 
  386. the same text string, press Alt-F6 (or SHIFT Alt-F6 if you want 
  387. only an exact match). See also the earlier section on Replacing 
  388. Text. 
  389.  
  390. Searching for Text Backwards            Shift-F6 
  391.  
  392. Having already done a search using F6 above, you can also search 
  393. backwards with Shift-F6, which searches backwards from the cursor 
  394. with a CaSe sensitive search. 
  395.  
  396. The straight key, F6 or F8 will perform the specified operation, 
  397. with a prompt for a text string parameter.  The operation is 
  398. performed with a case insensitive search.  That is, "CaSe" is the 
  399. same as "case". 
  400.  
  401. The Alt-F6 or Alt-F8 performs the same function, but with the same 
  402. text string as was entered with the non-Alt key. Again, the search 
  403. is case insensitive. 
  404.  
  405. Holding down Shift while pressing return on F6, Alt-F6 or Alt-F8 
  406. will cause the search to be done CASE SENSITIVE.  That is, "CaSe" 
  407. is NOT the same as "case". 
  408.  
  409. And finally, pressing Shift-F8, WITHOUT ALT, causes a global 
  410. replace all occurrences to be performed. While the above may seem 
  411. confusing at first, it provides a lot of flexibility and power for 
  412. search and replace operations.  Try these commands on a junk file 
  413. until you become familiar with their operation. 
  414.  
  415. Tab setting                             Alt-T 
  416.  
  417. Set the TAB key to tab to the current column, if you are on column 
  418. 4, TABS will occur at column 4, 8, 12, 16, etc. 
  419.  
  420.  
  421.